#Boa:Dialog:Dialog1

import wx
import ruleManager

def create(parent):
    return Dialog1(parent)

[wxID_DIALOG1, wxID_DIALOG1BUTTON1, wxID_DIALOG1FROMTXT, 
 wxID_DIALOG1STATICTEXT1, wxID_DIALOG1STATICTEXT2, wxID_DIALOG1STATICTEXT3, 
 wxID_DIALOG1STATICTEXT4, wxID_DIALOG1TOTXT, 
] = [wx.NewId() for _init_ctrls in range(8)]

class Dialog1(wx.Dialog):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_DIALOG1, name='', parent=prnt,
              pos=wx.Point(396, 150), size=wx.Size(291, 194),
              style=wx.DEFAULT_DIALOG_STYLE, title='')
        self.SetClientSize(wx.Size(275, 156))

        self.staticText1 = wx.StaticText(id=wxID_DIALOG1STATICTEXT1,
              label='Desde (>=): a', name='staticText1', parent=self,
              pos=wx.Point(16, 24), size=wx.Size(71, 13), style=0)

        self.staticText2 = wx.StaticText(id=wxID_DIALOG1STATICTEXT2,
              label='Hasta (<):', name='staticText2', parent=self,
              pos=wx.Point(16, 64), size=wx.Size(52, 13), style=0)

        self.fromTxt = wx.TextCtrl(id=wxID_DIALOG1FROMTXT, name='fromTxt',
              parent=self, pos=wx.Point(128, 24), size=wx.Size(84, 21), style=0,
              value='1')

        self.toTxt = wx.TextCtrl(id=wxID_DIALOG1TOTXT, name='toTxt',
              parent=self, pos=wx.Point(128, 56), size=wx.Size(84, 21), style=0,
              value='1')

        self.button1 = wx.Button(id=wxID_DIALOG1BUTTON1, label='Guardar',
              name='button1', parent=self, pos=wx.Point(24, 120),
              size=wx.Size(75, 23), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnSaveButton,
              id=wxID_DIALOG1BUTTON1)

        self.staticText3 = wx.StaticText(id=wxID_DIALOG1STATICTEXT3,
              label='-999999 significa -INF', name='staticText3', parent=self,
              pos=wx.Point(16, 40), size=wx.Size(105, 13), style=0)

        self.staticText4 = wx.StaticText(id=wxID_DIALOG1STATICTEXT4,
              label='999999 significa INF', name='staticText4', parent=self,
              pos=wx.Point(16, 80), size=wx.Size(97, 13), style=0)

    def __init__(self, parent, type):
        self._init_ctrls(parent)
        self.type = type

    def OnSaveButton(self, event):
        self.rule_spec = ruleManager.new_rule_spec(self.fromTxt.GetValue(), self.toTxt.GetValue(), [], 0, 0, 0, self.type)
        self.Close()
